{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 添加Nbextensions插件"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### jupyter插件"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "用了一段时间jupyter后，你发现，jupyter确实轻便、快捷。。<br>但是这也太简陋了吧。。。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "没关系，由于网页的易修改性，jupyter社区已经贡献了大量的插件，让jupyter的功能 更加强大"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "最简便地，我们可以下载nbextensions来拓展我们的jupyter"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 下载 Nbextensions"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "pip 下载 Nbextensions"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`pip install jupyter_contrib_nbextensions`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "激活"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`jupyter contrib nbextension install --user`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "重启jupyter notebook"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "没看到变化？不存在的，第一次加载时间有点长，先等个半分钟。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "发现变化后点击这个玩意<br>\n",
    "<img src=\"images/9.png\"/>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "里面就是各式各样的插件了，要哪个自便。<br>\n",
    "建议不要选太多，够用就行。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 友情推荐几款插件"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "详见官方文档 http://jupyter-contrib-nbextensions.readthedocs.io/en/latest/index.html <br>\n",
    "排名分先后"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<div class=\"toc\" style=\"margin-top: 1em;\"><ul class=\"toc-item\"><li><span><a href=\"#01.Table-of-Contents-(2)\" data-toc-modified-id=\"01.Table-of-Contents-(2)-1.3.1\">01.Table of Contents (2)</a></span></li><li><span><a href=\"#02.Variable-Inspector\" data-toc-modified-id=\"02.Variable-Inspector-1.3.2\">02.Variable Inspector</a></span></li><li><span><a href=\"#03.Hide-Header\" data-toc-modified-id=\"03.Hide-Header-1.3.3\">03.Hide Header</a></span></li><li><span><a href=\"#04.Collapsible-Headings\" data-toc-modified-id=\"04.Collapsible-Headings-1.3.4\">04.Collapsible Headings</a></span></li><li><span><a href=\"#05.ExecuteTime\" data-toc-modified-id=\"05.ExecuteTime-1.3.5\">05.ExecuteTime</a></span></li><li><span><a href=\"#06.Codefolding-;-Codefolding-in-Editor\" data-toc-modified-id=\"06.Codefolding-;-Codefolding-in-Editor-1.3.6\">06.Codefolding ; Codefolding in Editor</a></span></li><li><span><a href=\"#07.Snippets-Menu-;-Snippets\" data-toc-modified-id=\"07.Snippets-Menu-;-Snippets-1.3.7\">07.Snippets Menu ; Snippets</a></span></li><li><span><a href=\"#08.Highlighter\" data-toc-modified-id=\"08.Highlighter-1.3.8\">08.Highlighter</a></span></li><li><span><a href=\"#09.Keyboard-shortcut-editor\" data-toc-modified-id=\"09.Keyboard-shortcut-editor-1.3.9\">09.Keyboard shortcut editor</a></span></li><li><span><a href=\"#10.nbTranslate\" data-toc-modified-id=\"10.nbTranslate-1.3.10\">10.nbTranslate</a></span></li><li><span><a href=\"#11.Live-Markdown-Preview\" data-toc-modified-id=\"11.Live-Markdown-Preview-1.3.11\">11.Live Markdown Preview</a></span></li><li><span><a href=\"#12.Hide-Input-;-Hide-input-all\" data-toc-modified-id=\"12.Hide-Input-;-Hide-input-all-1.3.12\">12.Hide Input ; Hide input all</a></span></li><li><span><a href=\"#13.Gist-it\" data-toc-modified-id=\"13.Gist-it-1.3.13\">13.Gist-it</a></span></li><li><span><a href=\"#14.spellchecker\" data-toc-modified-id=\"14.spellchecker-1.3.14\">14.spellchecker</a></span></li><li><span><a href=\"#15.Datestamper打时间戳\" data-toc-modified-id=\"15.Datestamper打时间戳-1.3.15\">15.Datestamper打时间戳</a></span></li><li><span><a href=\"#16.Python-Markdown\" data-toc-modified-id=\"16.Python-Markdown-1.3.16\">16.Python Markdown</a></span></li><li><span><a href=\"#17.Split-Cells-Notebook\" data-toc-modified-id=\"17.Split-Cells-Notebook-1.3.17\">17.Split Cells Notebook</a></span></li><li><span><a href=\"#18.Code-prettify\" data-toc-modified-id=\"18.Code-prettify-1.3.18\">18.Code prettify</a></span></li><li><span><a href=\"#19.Select-CodeMirror-Keymap\" data-toc-modified-id=\"19.Select-CodeMirror-Keymap-1.3.19\">19.Select CodeMirror Keymap</a></span></li><li><span><a href=\"#20.2to3-Converter\" data-toc-modified-id=\"20.2to3-Converter-1.3.20\">20.2to3 Converter</a></span></li><li><span><a href=\"#21.Exercise-;-Exercise2\" data-toc-modified-id=\"21.Exercise-;-Exercise2-1.3.21\">21.Exercise ; Exercise2</a></span></li></ul></li></ul></li></ul></div>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 01.Table of Contents (2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "目录，强烈推荐。在文件较长的时候非常有用<br>\n",
    "唯一的不足是太丑，如果你有css，js基础的话，可以自己写脚本美化一下。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 02.Variable Inspector"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "查看对象对应的值，MATLAB玩家和喜欢IDE的童鞋可以尝试一下。<br>\n",
    "有趣的是，点击对象前的x号，即可将其从变量空间中清除<br>\n",
    "但是还是太丑。<br>\n",
    "<img src='images/24.gif'>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 03.Hide Header"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "使用Ctrl-H 隐藏头部，以扩展视野，很有用。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 04.Collapsible Headings"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "cell折叠工具，项目比较大，文件比较长的时候很有用。<br>\n",
    "<img src='images/20.png'>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 05.ExecuteTime"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "自动记录代码cell执行时间<br>\n",
    "<img src=\"images/12.png\"/><br>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 06.Codefolding ; Codefolding in Editor"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "折叠代码，当代码很长的时候比较有用。<br>\n",
    "<img src=\"images/11.png\"/>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 07.Snippets Menu ; Snippets"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "插入代码片，懒省事或者忘掉某些代码怎么写的时候有用。\n",
    "* Snippets Menu\n",
    "<img src=\"images/15.png\"/><br>\n",
    "* Snippets\n",
    "<img src=\"images/23.gif\"/><br>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "注意：可以自定义插入内容<br>\n",
    "对于需要重复使用的代码(比如初始化环境时，导入通常要用到的库)，将其写为snippet不失为一个好主意。<br>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 08.Highlighter"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "文字高亮<br>\n",
    "<img src='images/21.gif'>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 09.Keyboard shortcut editor"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "自定义快捷键<br>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 10.nbTranslate"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Alt-T 翻译<br>\n",
    "<img src='images/22.gif'>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 11.Live Markdown Preview"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "实时显示Markdown内容，编写letax的时候十分有用"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 12.Hide Input ; Hide input all"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "做给非程序员展示的时候有用<br>\n",
    "<img src=\"images/13.png\"/><br>\n",
    "<img src=\"images/17.png\"/><br>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 13.Gist-it"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "随手发布gist\n",
    "<img src=\"images/16.png\"/><br>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 14.spellchecker"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "拼写检查"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 15.Datestamper"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "打时间戳"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 16.Python Markdown"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "可以在Markdown中实时显示Python变量，交互式绘图时很有用"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 17.Split Cells Notebook"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "如下效果<br>\n",
    "<img src=\"images/18.png\"/><br>\n",
    "有时候绘图的时候有用"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 18.Code prettify"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "代码美化工具<br>\n",
    "<img src=\"images/19.gif\"/><br>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 19.Select CodeMirror Keymap"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "赐予你上古神器vim、Emacs和现在比较流行的准神器sublime。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 20.2to3 Converter"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "py2到py3的转换器"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 21.Exercise ; Exercise2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "用于折叠问题答案，教学用。对于普通开发、实验人员好像没什么用<br>\n",
    "<img src=\"images/14.gif\"/><br>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "很多东西都是一个从少到多，再从多到少的过程，尝试一下每个插件，再精选几个常用的即可，开启太多插件反倒会浪费加载时间。"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  },
  "nbTranslate": {
   "displayLangs": [
    "*"
   ],
   "hotkey": "alt-t",
   "langInMainMenu": true,
   "sourceLang": "en",
   "targetLang": "fr",
   "useGoogleTranslate": true
  },
  "toc": {
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": true,
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": "block",
   "toc_window_display": true
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
